#ifndef UTILS_H
#define UTILS_H

#include "utility/Types.h"
#include <stdarg.h>

void Strcpy(char *dest, const char *src);
void Strncpy(char *dest, const char *src, int size);
int Strlen(const char *str);
int Strncmp(const char *s1, const char *s2, int size);
void Memcpy(void *dest, void *src, int size);
void Memset(void *dest, uint8_t v, int size);
bool Memcmp(void *d1, void *d2, int size);

uint32_t UpAlign(uint32_t size, uint32_t bound);
uint32_t DownAlign(uint32_t size, uint32_t bound);

void StringFormat(char* buffer, const char* format, ...);
void StringFormatArgs(char* buffer, const char* format, va_list args);
int StringCount(char** start);
char* GetFileName(char* name);


void IntToChar(char* buff, int value, int base);

// __FILE__, __LINE__, __FUNCTION__, #condition is automatically generated by C
#define ASSERT(condition)   if(!(condition)) Error(__FILE__, __LINE__, __FUNCTION__, #condition)
void Error(const char* file, int line, const char* func, const char* condition);


#endif